package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.EcgEntity

@Dao
interface EcgDao {

    @Insert
    suspend fun insert(ecgEntity: EcgEntity)

    @Update
    suspend fun update(ecgEntity: EcgEntity)

    @Delete
    suspend fun delete(ecgEntity: EcgEntity)

    @Query("DELETE FROM ecgMeasure")
    suspend fun deleteAll()

    @Query("SELECT * FROM ecgMeasure")
    fun getEcg(): LiveData<List<EcgEntity>>

    @Query("SELECT * FROM ecgMeasure WHERE  timeRecordLong >:before and timeRecordLong <:after")
    fun getEcgByTime(before: Long, after: Long): LiveData<List<EcgEntity>>
}